/**
 * Created by zhanghuan on 17-3-2.
 */

/**
 * 标准对话框，数据包含 context（上下文） handlers（回调函数）
 * 对话框类型，格式为 '<Namespace>/<DialogName>'
 */

export default {
    namespace: 'dialog',
    state: {
        type: '',
        component: null,
        context: {},
        handlers: {},
    },
    reducers: {
        openDialog(state, { payload: { type = '', component = null, context = {}, handlers = {} } }) {
            if (type.indexOf('/') === -1) return;
            return { context, handlers, component, type };
        },
        closeDialog(state) {
            return { ...state, type: '', component: null };
        },
    },
    effects: {

    },
    subscriptions: {
    },
};
